/**
 * @author bipul_sinha
 * @version 1.0
 * @created 10th November, 2010.
 *
 * AbstractBaseEntity
 *
 * Copyright @ 2010 by 
 * All Rights Reserved.
 * CONFIDENTIAL AND TRADE SECRET
 */
package com.ces.knacky.framework.model;

import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

/**
 * Top most base class for all persistent object in the hierarchy. It provides the contract 
 * definition defined in IEntity interface. All persistent object must have at least the Id value
 * and in case of description not available it would be null.
 * 
 * All persistent classes which have only Id, Description pair <B>must</B> inherit this class.
 *    
 * @author bipul_sinha
 * @see IEntity	
 */
public abstract class AbstractBaseEntity implements IEntity {
	/**
	 * Represents id of the current persistent object.
	 */
	protected Integer id;
	/**
	 * Represents description of the current persistent object.
	 */
	protected String description;
    /**
     * This method is used to return the Id value of the current persistent object.
     * 
     * @return 	Integer
     * 			Represents id of the current persistent object.	
     */
	public Integer getId() {
		return id;
	}
	/**
	 * This method is used to set the identifier of the persistent object.
	 * 
	 * @param 	id
	 * 			Represents id of the current persistent object.
	 */
	public void setId(Integer id) {
		this.id = id;
	}
    /**
     * This method is used to return the description value of the current persistent object.
     * 
     * @return	String
     * 			Represents description of the current persistent object.
     */
	public String getDescription() {
		return description;
	}
	/**
	 * This method is used to set the description of the persistent object.
	 * 
	 * @param 	description
	 * 			Represents description of the current persistent object.
	 */
	public void setDescription(String description) {
		this.description = description;
	}
	@Override
    public String toString() {
        return new ToStringBuilder(this)
            .append("Id", getId())
            .toString();
    }
	@Override
    public int hashCode() {
        return new HashCodeBuilder()
            .append(getId())
            .toHashCode();
    }
}
